import {apiGetBrandList} from '@/api/product/tradeMark'
import {Message} from 'element-ui'

const state = {
  brandInfo: {} // 品牌信息
}
const mutations = {
  GETBRANDLIST(state, val){
    state.brandInfo = val
  }
}
const actions = {
  // 获取品牌的基础分类，{limit, page}
  async getBrandList({commit}, {page,limit}) {
    let res = await apiGetBrandList(page,limit)
    if (res.code === 200) {
      commit('GETBRANDLIST', res.data)
      return Promise.resolve('ok')
    }else {
      Message({
        message: '获取数据失败',
        type: 'error'
      })
    }
  }
}
export default {
  namespaced: true,
  state,
  mutations,
  actions
}
